﻿using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using SalaryReport.Core.Excel;

namespace SalaryReport
{
    public partial class DetailsForm : Form
    {
        private const int topMargin = 40;
        private const int leftMargin = 65;
        private const int lblWidth = 200;
        private const int lblHeight = 20;
        private const int margin = 5;

        public DetailsForm()
        {
            InitializeComponent();
        }

        public DetailsForm(List<ExcelData> items)
            :this()
        {
            for (var i = 0; i < items.Count; i++)
            {
                var name = new Label
                               {
                                   Text = items[i].Name,
                                   Location = new Point(leftMargin + margin, topMargin + margin * i + lblHeight * i)
                               };
                var value = new Label
                                {
                                    Text = items[i].Value,
                                    Location = new Point(leftMargin + margin * 2 + lblWidth, topMargin + margin * i + lblHeight * i)
                                };
                Controls.Add(name);
                Controls.Add(value);
            }
        }
    }
}
